package TcpDictServer;

import TcpEchoServer.TcpEchoServerThread2;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TcpDictServer extends TcpEchoServerThread2 {
    Map<String,String> dict = new HashMap<>();
    public TcpDictServer(int port) throws IOException {
        super(port);

        dict.put("dog","小狗");
        dict.put("cat","小猫");
        dict.put("pussy","浦西");
        dict.put("sick","病的");
        dict.put("set","设置");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"没找到该单词");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer dictServer = new TcpDictServer(9898);
        dictServer.start();
    }
}
